/*
Copyright 2025 PerfXLab (Beijing) Technologies Co., Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "OpenSparseBLAS_func.h"
#include "OpenSparseBLAS_type.h"

#ifdef __cplusplus
extern "C"
{
#endif
    void print_Vector_BOOL(OpenSpB_vector v);
    void print_Vector_INT32(OpenSpB_vector v);
    void print_Vector_FP32(OpenSpB_vector v);
    void print_Matrix_INT32(OpenSpB_matrix m);
    void print_Matrix_FP32(OpenSpB_matrix m);
    void print_Matrix_BOOL(OpenSpB_matrix m);
#ifdef __cplusplus
}
#endif

#include <stdlib.h>
#define SAFE_CALL(method)    \
    info = method;           \
    if (info != OpenSpB_success) \
    {                        \
        exit(9);             \
    }


#define CHECK_CUDA(func)                                               \
    {                                                                  \
        cudaError_t status = (func);                                   \
        if (status != cudaSuccess)                                     \
        {                                                              \
            printf("CUDA API failed at line %d with error: %s (%d)\n", \
                   __LINE__, cudaGetErrorString(status), status);      \
            return EXIT_FAILURE;                                       \
        }                                                              \
    }
